//
//  HHPickerSample.swift
//  HHSwiftuiPractice
//
//  Created by YL-Hong on 2023/10/8.
//SwiftUI中的Picker用于从一个值选择器中选择单个值。它的主要特点包括:
/**
 数据绑定
 数据提供
 内置丰富的样式
 */



import SwiftUI

struct HHPickerSample: View {
    
    @State var selected = "One"
    
    var body: some View {
        VStack {
            Picker("title", selection: $selected) {
                Text("One").tag("One")
                Text("Two").tag("Two")
                Text("Three").tag("three")
            }.pickerStyle(.menu)
        
            Picker("title", selection: $selected) {
                Text("One").tag("One")
                Text("Two").tag("Two")
                Text("Three").tag("three")
            }.pickerStyle(.inline)
            
            Picker("title", selection: $selected) {
                Text("One").tag("One")
                Text("Two").tag("Two")
                Text("Three").tag("three")
            }.pickerStyle(.segmented)
            
            
        }.padding()
        
        
    }
}

struct HHPickerSample_Previews: PreviewProvider {
    static var previews: some View {
        HHPickerSample()
    }
}
